import pytest
import yaml
import time
import json
import os
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.support.select import Select
from web.testtestceshiren import Ceshiren


class Testceshiren():
    def setup_class(self):
        self.ceshiren = Ceshiren()

    def teardown_class(self):
        self.ceshiren.close()

    # cookei保存到cookie.yaml
    def test_cookei_get(self):
        self.ceshiren.cookei_get()

    def test_search_open(self):
        self.ceshiren.open()
        self.ceshiren.add_cookie()
        self.ceshiren.search_open()

    @pytest.mark.parametrize("keyword", ['自动化测试'])
    def test_search(self, keyword):
        assert '自动化' in self.ceshiren.search_text(keyword)[0]



